﻿using CNav.Domain;
using FluentValidation;

namespace CNav.Business.Validation
{
    public class ComplaintTypeValidation : AbstractValidator<ComplaintType>
    {
        public ComplaintTypeValidation()
        {
            RuleFor(a => a.Code).Must(c => !c.Contains(" ")).WithMessage("Complaint type code must not contain spaces");
            RuleFor(a => a.Code).NotEmpty().Length(4, 50).WithMessage("Please provide complaint code atleast 4 and 50 character long");
            RuleFor(a => a.Description).NotEmpty().Length(2, 100).WithMessage("Please provide description atleast 6 and 100 character long");
        }
    }
}